import time
import threading

def get_url(url):
    print("get_url started")
    time.sleep(2)
    print("get_url end")


def get_detail(url):
    print("get_detail started")
    time.sleep(4)
    print("get_detail end")


if __name__ == '__main__':
    t1 = threading.Thread(target=get_url,args=("https://www.baidu.com",))
    t2 = threading.Thread(target=get_detail,args=("https://www.baidu.com",))
    start_time = time.time()
    t1.start()
    t2.start()
    # 设置守护，主线程退出
    # t1.setDaemon(True)
    # t2.setDaemon(True)
    t1.join()
    t2.join()
    print(f"耗时:{time.time()-start_time}")